<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Tell whether a day is a weekday, weekend or a day that has a transition between the two</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getavailablelocales.html">IntlCalendar::getAvailableLocales</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrorcode.html">IntlCalendar::getErrorCode</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intlcalendar.getdayofweektype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::getDayOfWeekType</h1>
  <p class="verinfo">(PHP 5.5.0, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getDayOfWeekType</span> &mdash; <span class="dc-title">Tell whether a day is a weekday, weekend or a day that has a transition between the two</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.getdayofweektype-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>IntlCalendar::getDayOfWeekType</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$dayOfWeek</code></span>
   )</div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>intlcal_get_day_of_week_type</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$cal</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$dayOfWeek</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns whether the passed day is a weekday
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>), a weekend day
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>), a day during which a
   transition occurs into the weekend
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong>) or a day during
   which the weekend ceases
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>).
  </p>
  <p class="para">
   If the return is either
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>, then
   <span class="function"><a href="intlcalendar.getweekendtransition.html" class="function">IntlCalendar::getWeekendTransition()</a></span> can be called to
   obtain the time of the transition.
  </p>
  <p class="para">
   This function requires ICU 4.4 or later.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.getdayofweektype-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">cal</code></em></dt>

    <dd>

     <p class="para">
      The IntlCalendar resource.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">dayOfWeek</code></em></dt>

    <dd>

     <p class="para">
      One of the constants <strong><code>IntlCalendar::DOW_SUNDAY</code></strong>,
      <strong><code>IntlCalendar::DOW_MONDAY</code></strong>, …,
      <strong><code>IntlCalendar::DOW_SATURDAY</code></strong>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.getdayofweektype-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns one of the constants 
   <strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>,
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>,
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.getdayofweektype-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2536">
   <p><strong>Example #1 <span class="function"><strong>IntlCalendar::getDayOfWeekType()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">foreach&nbsp;(array(</span><span style="color: #DD0000">'en_US'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'ar_SA'</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$locale</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Locale:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">getDisplayName</span><span style="color: #007700">(</span><span style="color: #0000BB">$locale</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"en_US"</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cal&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #DD0000">'UTC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$locale</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SUNDAY</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SATURDAY</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDayOfWeekType</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"&nbsp;"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDayOfWeekType</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;&gt;=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_TYPE_WEEKEND_OFFSET<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getWeekendTransition</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Locale: English (United States)
1 3 86400000
2 0 
3 0 
4 0 
5 0 
6 0 
7 1 

Locale: Arabic (Saudi Arabia)
1 0 
2 0 
3 0 
4 0 
5 1 
6 3 86400000
7 0 

</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getavailablelocales.html">IntlCalendar::getAvailableLocales</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrorcode.html">IntlCalendar::getErrorCode</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
